const validator = require('validator');
const isEmpty = require('./is-empty')
 module.exports = function validateEducationInput(data){
     let errors = {};

     data.title = isEmpty(data.title) ? '' : data.title;
     data.company = isEmpty(data.company) ? '' : data.company;
     data.from = isEmpty(data.from) ? '' : data.from;

     if (validator.isEmpty(data.title)) {
        errors.title = '个人经历titile不能为空';
     }   
     if (validator.isEmpty(data.company)) {
        errors.company = '公司名称不能为空';
     } 
     if (validator.isEmpty(data.from)) {
        errors.from = '个人经历from不能为空';
     } 
     return {
         errors,
         isValid:isEmpty(errors)
     }
 }